package com.example.yucheng.service.impl;

import com.example.yucheng.mapper.WarnMapper;
import com.example.yucheng.domain.Warn;
import com.example.yucheng.service.WarnService;
import com.example.yucheng.util.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WarnServiceImpl implements WarnService {

    @Autowired
    WarnMapper warnDao;
    public List<Warn> getAllList(){
        return warnDao.getAllList();
    }
    public List<Warn> getIsWarnByLimit(){
        return warnDao.getIsWarnByLimit();
    }
    @Override
    public List<Warn> getWarnByLimit(PageQuery pageQuery) {
        if (pageQuery.getSort()==1){
            return    warnDao.ascgetWarnByLimit(pageQuery);
        }else{
            return warnDao.getWarnByLimit(pageQuery);
        }
    }

    @Override
    public int deleteWarnById(Integer id) {
        return warnDao.deleteWarnById(id);
    }

    @Override
    public int insertWarn(Warn warn) {
        return warnDao.insertWarn(warn);
    }

    @Override
    public int updateWarn(Warn warn) {
        return warnDao.updateWarn(warn);
    }
}
